
package com.yzkj.cpjxc.business.framework.utils.property;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 读取properties信息内容
 */
public class PropertyFileUtil {

	private Properties prop = null;

	/**
	 * @param propertyFile 是相对于根路径的，如all.properties统一放在 根的 properties目录下, 那么传进来的值应该为 properties/all.properties 
	 */
	public PropertyFileUtil(String propertyFile) {
		InputStream is = PropertyFileUtil.class.getResourceAsStream("/" + propertyFile);
		prop = new Properties();
		try {
			prop.load(is);
			is.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public String getProperties(String propertyKey) {
		return prop.getProperty(propertyKey);
	}
}
